<template>
  <div class="waiting-info">
    <div class="list-item-setting">
      <div class="title-info">
        <el-divider content-position="left">区域设置</el-divider>
      </div>
      <el-form-item label="内容高度">
        <el-input-number
            v-model="optionsInfo['areaHeight']"
            :min="640"
            size="small"
            class="hide-spin-button"
        />
      </el-form-item>
<!--      {{optionsInfo}}-->
      <template v-if="optionsInfo['currentShown']">
        <div class="title-info">
          <el-divider content-position="left">诊室区域</el-divider>
        </div>
        <div class="content">
          <roomNameKeyEditor
            businessType="special"
            :designer="designer"
            :selected-widget="selectedWidget"
            :option-model="optionModel"
          />
        </div>
        <el-form-item label="文字大小">
          <el-input-number
            v-model="optionsInfo.winArea['fontSize']"
            size="small"
            class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="字体颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['winArea'].color"/>
        </el-form-item>
        <el-form-item label="背景颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['winArea'].bgColor"/>
        </el-form-item>
        <div class="title-info">
          <el-divider content-position="left">就诊提示区域</el-divider>
        </div>
        <el-form-item label="文案">
          <el-input
              v-model="optionsInfo.currTitleArea['text']"
              size="small"
              class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="文字大小">
          <el-input-number
              v-model="optionsInfo.currTitleArea['fontSize']"
              size="small"
              class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="字体颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['currTitleArea'].color"/>
        </el-form-item>
        <el-form-item label="背景颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['currTitleArea'].bgColor"/>
        </el-form-item>
        <div class="title-info">
          <el-divider content-position="left">就诊患者区域</el-divider>
        </div>
        <el-form-item label="文字大小">
          <el-input-number
            v-model="optionsInfo.currArea['fontSize']"
            size="small"
            :max="100"
            :min="60"
            class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="字体颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['currArea'].color"/>
        </el-form-item>
        <el-form-item label="背景颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['currArea'].bgColor"/>
        </el-form-item>
      </template>

      <template v-if="optionsInfo['waitingShown']">
        <div class="title-info">
          <el-divider content-position="left">等待区域</el-divider>
        </div>
        <el-form-item label="文案" >
          <el-input
              size="small"
              v-model="optionsInfo['waitArea']['text']"
              class="hide-spin-button"
          />
        </el-form-item>

        <el-form-item label="文字大小">
          <el-input-number
              v-model="optionsInfo['waitArea']['fontSize']"
              size="small"
              class="hide-spin-button"
          />
        </el-form-item>
        <el-form-item label="字体颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['waitArea'].color"/>
        </el-form-item>
        <el-form-item label="背景颜色" class="column-area">
          <el-color-picker
            size="small"
            show-alpha
            :predefine="predefineColors"
            v-model="optionsInfo['waitArea'].bgColor"/>
        </el-form-item>

        <el-form-item label="候诊类型设置" class="wait-patient-set">
          <el-radio-group v-model="optionsInfo.waitPatientType">
            <el-radio :label="item.value" v-for="item in waitPatientTypeOptions" :key="item.value">
              {{ item.label }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="开启滚动">
          <el-switch v-model="optionsInfo['waitArea'].openScroll"/>
        </el-form-item>
        <el-form-item label="滚动速度" class="column-info">
          <el-input-number
            :min="1"
            :max="5"
            :step="0.5"
            size="small"
            class="hide-spin-button"
            :disabled="!(optionsInfo['waitArea'].openScroll)"
            v-model="optionsInfo['waitArea'].step"
          />
        </el-form-item>
      </template>

      <template v-if="optionsInfo['deptConfig']">
        <el-form-item label="顶部属性设置" class="column-area">
          <el-radio-group v-model="optionsInfo['titleType']">
            <el-radio  v-for="(item) in titleTypeOptions" :label="item.value" :key="item.value">{{item.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </template>
    </div>
  </div>
</template>

<script>
import * as types from "@c/public/form-designer/devType/datas-types";
import roomNameKeyEditor from "@detailsEdit/scene-edit/basicInfo/roomNameKey-editor.vue";
export default {
  name: "waitSingleConfig-editor",

  componentName: "sceneWaitingCurrent-editor",

  components: {
    roomNameKeyEditor
  },

  mixins: [],

  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
  },

  inject: ['serverFieldList', 'getDesignerConfig'],

  data() {
    return {
      optionsInfo: Object(),
      predefineColors: types['predefineColors'],
      titleTypeOptions: [
        {
          value: 'treatmentRoomName',
          label: '诊室'
        },
        {
          value: 'registerObjNames',
          label: '号别'
        },
        {
          value: 'deptName',
          label: '科室'
        },
        {

          value: 'treatmentRoomName-registerObjNames',
          label: '诊室-号别'
        }
      ],
      waitPatientTypeOptions:types['waitPatientTypeOptions'],
    }
  },

  computed: {},

  methods: {},

  watch: {
    // 组件的所有信息
    optionModel: {
      handler: function (val) {
        this.optionsInfo = val[val.config];
      },
      deep: true,
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>
.column-area{
  display: flex;
  flex-direction: column;
  :deep(.el-form-item__label){
    width: 100% !important;
    margin-bottom: 10px;
  }
  :deep(.el-form-item__content){
    width: 100%;
    margin-left: 0 !important;
    .el-radio-group{
      width: 100%;
      display: flex;
      flex-direction: column;
      .el-radio{
        margin-bottom: 10px;
      }
    }
  }

}

.wait-patient-set {
  display: flex;
  flex-direction: column;

  :deep(.el-form-item__label) {
    width: 100% !important;
  }

  :deep(.el-form-item__content) {
    margin-left: 0 !important;;

    .el-radio-group {
      display: flex;
      flex-direction: column;

      .el-radio {
        padding: 10px 0;
      }
    }
  }

}
</style>
